package com.oabase.ibatis;

import java.io.IOException;
import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class SqlMapFactory {

	protected SqlMapClient sqlMap;

	public static final String SQLMAP_CONFIG_FILE = "conf/sqlmap/sqlMapConfig.xml";

	protected SqlMapFactory(){
		try {
			Reader read = Resources.getResourceAsReader(SQLMAP_CONFIG_FILE);
			sqlMap = SqlMapClientBuilder.buildSqlMapClient(read);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public SqlMapClient getSqlMapInstance() {
		return sqlMap;
	}

}
